import React, { Component } from 'react';
import { Calendar } from 'antd-mobile';
import { formatDate } from '@/assets/js/methods'
import "./OrderProgress.scss"
import "./Salesentryorder.scss"
import { Button } from 'antd-mobile'

const now = new Date();
class Salesentryorder extends Component {
	originbodyScrollY = document.getElementsByTagName('body')[0].style.overflowY;
	constructor() {
		super()
		this.state = {
			show: false,
			config: {
				type: 'one'
			},
		}
	}
	onSelectHasDisableDate = (dates) => {
		console.warn('onSelectHasDisableDate', dates);
	}

	onConfirm = (startTime) => {
		console.log(startTime.getTime())
		document.getElementsByTagName('body')[0].style.overflowY = this.originbodyScrollY;
		this.setState({
			show: false,
			startTime: formatDate(startTime.getTime())
		});
	}

	onCancel = () => {
		document.getElementsByTagName('body')[0].style.overflowY = this.originbodyScrollY;
		this.setState({
			show: false,
			startTime: undefined,
			endTime: undefined,
		});
	}
	componentDidMount() {
		document.getElementsByTagName('title')[0].innerHTML = '销售录入订单'
		this.setState({
			startTime: formatDate(new Date().getTime())
		})
	}
	render() {
		let height = window.screen.height
		return (
			<div className="other-page OrderProgress platformreconciliation" style={{ minHeight: height + 'px' }}>
				<div className="topbar flex y-center space-between">
					<span className="flex y-center">
						<span>日期选择:</span>
					</span>
					<span className="flex y-center">
						<span>{this.state.startTime}</span>
						<img src={require('../../images/calendar.png')}
							alt=""
							className="ml20"
							onClick={() => {
								document.getElementsByTagName('body')[0].style.overflowY = 'hidden';
								this.setState({
									show: true
								});
							}} />
					</span>
				</div>

				<div className='tabbox'>
					<div>
						<img src={require('../../images/order1.png')} />
						<span style={{ color: '#ff6d75' }}>新订单</span>
					</div>
					<div>
						<img src={require('../../images/fineshed.png')} />
						<span>已完成</span>
					</div>
					<div>
						<img src={require('../../images/evaluationgrey.png')} />
						<span>已评价</span>
					</div>
				</div>

				<div className='salemodalbox'>
					<div className='row1 border-b'>
						<span>安装净水器</span>
						<span style={{ color: '#4d638c' }}>销售员：鞠志锋</span>
						<img src={require('../../images/xin.png')} />
					</div>
					<div className='row2 border-b'>
						<div className='row2item'>
							<span>订单信息：</span>
							<span>12345621</span>
						</div>
						<div className='row2item'>
							<span>账户名称：</span>
							<span>17710368721</span>
						</div>
						<div className='row2item'>
							<span>详细地址：</span>
							<span>北京市朝阳区立水桥</span>
						</div>
					</div>
					<div className='row1' style={{ paddingLeft: '15px' }}>
						<span>订单金额：2880元</span>
						<span>提成：<span style={{ color: '#ff565f' }}>200元</span></span>
					</div>
				</div>

				<Button className='big-color-but'>编辑订单</Button>

				<Calendar
					{...this.state.config}
					visible={this.state.show}
					onCancel={this.onCancel}
					onConfirm={this.onConfirm}
					onSelectHasDisableDate={this.onSelectHasDisableDate}
					getDateExtra={this.getDateExtra}
					defaultDate={now}
					minDate={new Date(+now - 5184000000)}
					maxDate={new Date(+now + 31536000000)}
				/>
			</div>
		);
	}
}

export default Salesentryorder;